<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class CreateWatchLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('watch_log', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->integer("watch_time")->index()->comment("查看时间");
            $table->string("user_phone")->index()->comment("用户手机号")->nullable();
            $table->bigInteger("user_id")->index()->comment("用户id");
            $table->bigInteger("good_id")->index()->comment("外联的产品id");
            $table->integer("click_num")->default(1);
            $table->integer("location_id")->index()->nullable()->comment("外联id");
        });
        DB::statement("ALTER TABLE `watch_log` comment'外联的客户扫码表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('watch_log');
    }
}
